﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace throneOfGames.Models
{
    public class ThroneRepository : IThroneRepository
    {
        private throneOfGamesDataContext db = new throneOfGamesDataContext();
        public IEnumerable<User> AllUsers
        {
            get
            { return db.Users; }
            set
            {
            }
        }

        public IEnumerable<Boardgame> AllBoardgames
        {
            get
            { return db.Boardgames; }
            set
            {
            }
        }

        public IEnumerable<Game> AllGames
        {
            get
            { return db.Games; }
            set
            {
            }
        }

        public IEnumerable<Player> AllPlayers
        {
            get
            { return db.Players; }
            set
            {
            }
        }

        public IEnumerable<LeaderboardData> AllLeaderboardData
        {
            get { return db.LeaderboardDatas; }
            set { }
        }

        public void newPlayer(int userID, int gameID, int playerNum)
        {
            db.newPlayer(userID, gameID, playerNum);
        }

        public int createGame(int user, int maxPlayers, bool isPublic, int bgID)
        {
            return db.createGame(user, maxPlayers, isPublic, bgID);
        }

        public void removePlayer(int pID)
        {
            db.removePlayer(pID);
        }

        public void insertUser(string userName, System.Data.Linq.Binary pass, string email)
        {
            db.insertUser(userName, pass, email);
        }

        public void updateUser(int userID, string userName, System.Data.Linq.Binary pass, string email)
        {
            db.updateUser(userID, userName, pass, email);
        }

        public void startGame(int gameID)
        {
            db.startGame(gameID);
        }
    }
}